#pragma once
#include "vocoder.h"
#include <vector>

/*
Stores sequences of frequencies and returns the appropriate frequency at each GetFrequency call.
Useful for making the carrier create a tune.
When the sequence is finished, this FrequencyProvider loops back to the sequence beeginning and starts over again.
*/
class SequencedFrequencyProvider :
	public FrequencyProvider
{
public:
	SequencedFrequencyProvider(void);
	virtual ~SequencedFrequencyProvider(void);

	unsigned int GetFrequency(short* sample, unsigned int length, std::vector<SampleMarker>* markers);

	/*
	Adds a note (frequency) with the specified duration (sampleCount) to the current frequency sequence.
	*/
	void AddSequence(unsigned int frequency, unsigned int sampleCount);

	/*
	Clears the frequency sequence.
	*/
	void ClearSequences();

private:
	std::vector<unsigned int> freqs;
	std::vector<unsigned int> durations;
	unsigned int roundRobin;
	unsigned int curIdx;
};
